package com.stars.services.impl.pshow;

import com.github.pagehelper.PageInfo;
import com.stars.entity.dto.pshow.PShowCkDTO;
import com.stars.dao.mapper.pshow.PShowCkMapper;
import com.stars.entity.pshow.PShowCkEntity;
import com.stars.services.pshow.PShowCkAccessServices;
import com.stars.dao.mapper.pshow.PShowCkMapper;

import java.util.List;
import com.stars.entity.ListPage;
import com.github.pagehelper.PageHelper;
import com.stars.services.impl.BaseAccessServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: 仓库管理 业务逻辑
 * @author 肖伟
 * @date 2020-01-04
 * @version V1.0
 *
 */
@Service
public class PShowCkAccessServicesImpl  extends BaseAccessServiceImpl<PShowCkMapper , PShowCkEntity> implements  PShowCkAccessServices {
    @Autowired
    private PShowCkMapper  pShowCkMapper;


    /**
     * 分页查询
     * @param pageNum 查询参数 起始页，大小。
     * @return
     */
    @Override
    public PageInfo<PShowCkDTO> pageList(Integer pageNum, Integer pageSize, PShowCkDTO dto) throws Exception{
        ListPage<PShowCkDTO> listPage = new ListPage<>(pageNum, pageSize, dto);
        PageHelper.startPage(pageNum, pageSize);
        List<PShowCkDTO> list = pShowCkMapper.pageQueryPShowCk(listPage);
        PageInfo<PShowCkDTO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PShowCkDTO findDtoById(String id) {
        if (StringUtils.isBlank(id)) {
            return null;
        }
        return pShowCkMapper.selectDtoById(id);
    }

}
